﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DC2010_Editor.Controls.Utils;
using DC2010_Editor.Formulars;
using DC2010.Objects;

namespace DC2010.Tools
{
    public partial class ItemsPlacementTextBox : UserControl
    {
        private List<DungeonPlacement> _fiList { get; set; }
        public ItemsPlacementTextBox()
        {
            InitializeComponent();
        }

        public void SetRelatedObject(List<DungeonPlacement> fiList)
        {
            _fiList = fiList;
            if (_fiList != null)
            {
                PromptText = string.Format("Total: {0} items.", _fiList.Count);
            }
            else
            {
                PromptText = string.Format("There are no related items.");
            }
        }

        private void textBox1_MouseHover(object sender, EventArgs e)
        {
            textBox1.BackColor = Color.FromArgb(212, 255, 212);
        }

        private void textBox1_MouseLeave(object sender, EventArgs e)
        {
            textBox1.BackColor = Color.FromArgb(192,255,192);
        }

        private void textBox1_Click(object sender, EventArgs e)
        {
            ItemsPlacement ip = new ItemsPlacement(_fiList);
            ip.ShowDialog();

            if (_fiList != null)
            {
                PromptText = string.Format("Total: {0} items.", _fiList.Count);
            }
            else
            {
                PromptText = string.Format("There are no related items.");
            }
        }

        public string InnerText
        {
            get
            {
                return textBox1.Text;
            }
            set
            {
                textBox1.Text = value;
            }
        }

        public string PromptText
        {
            get
            {
                return textBox1.PromptText;
            }
            set
            {
                textBox1.PromptText = value;
            }
        }
    }
}
